package com.xqboss.web.controller.user;

import com.xqboss.apps.domain.user.UserWrenchProductionRecord;
import com.xqboss.apps.dto.user.UserWrenchProductionRecordListDto;
import com.xqboss.apps.service.user.UserWrenchProductionRecordService;
import com.xqboss.common.core.controller.BaseController;
import com.xqboss.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author 木鱼
 * @since 2024-01-09
 */
@RestController
@Slf4j
@Api(tags = "扳手工厂记录")
@RequestMapping("/web/userWrenchProductionRecord")
@RequiredArgsConstructor
public class UserWrenchProductionRecordController extends BaseController {

    private final UserWrenchProductionRecordService basicService;

//    /**
//     *  列表查询
//     */
//    @GetMapping("/list")
//    @ApiOperation(" 列表查询")
//    public R<List<UserWrenchProductionRecord>> loadList(@Validated BaseRequest request) {
//        return R.ok(basicService.selectBasicList(request));
//    }
//
//    /**
//     *  根据id查询
//     */
//    @GetMapping("/selectById")
//    @ApiOperation(" 根据id查询")
//    public R<UserWrenchProductionRecord> selectById(@RequestParam("id") Long id) {
//        return R.ok(basicService.selectByIdBasic(id));
//    }
//
//    /**
//     *  修改
//     */
//    @PostMapping("/update")
//    @ApiOperation(" 修改")
//    public R<Boolean> update(@Validated @RequestBody UserWrenchProductionRecord record) {
//        return R.ok(basicService.updateBasic(record));
//    }
//
//    /**
//     *  新增
//     */
//    @PostMapping("/insert")
//    @ApiOperation(" 新增")
//    public R<Boolean> insert(@Validated @RequestBody UserWrenchProductionRecord record) {
//        return R.ok(basicService.saveBasic(record));
//    }
//
//    /**
//     *  删除
//     */
//    @PostMapping("/delete/{id}")
//    @ApiOperation(" 删除")
//    public R<Boolean> delete(@PathVariable Long id) {
//        return R.ok(basicService.removeBasic(id));
//    }

    @PreAuthorize("@ss.hasPermi('web:userWrenchProductionRecord:list')")
    @ApiOperation("获取扳手生产记录")
    @PostMapping("/list")
    public R<List<UserWrenchProductionRecord>> list(@RequestBody @Validated UserWrenchProductionRecordListDto dto) {
        List<UserWrenchProductionRecord> list = basicService.getList(dto);
        return R.ok(list);
    }
}
